#include "singer.h"

#include <QtGui>
#include "ktv/model/resource/resource.h"
#include "ktv/gui/list/mylist.h"

Singer::Singer(QGraphicsItem *parent)
    : MyItem(parent)
{
    backgroundPixmap = Resource::getInstance()->backgroundPixmap_singer;
}

void Singer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);
    painter->drawPixmap(-width/2, -height/2, width, height, *backgroundPixmap);
    painter->setFont(QFont("Times", 60, QFont::Bold));
    if (pixmapLocation == "") {
        painter->drawText(-100, 0, data(MyList::NAME).toString());
    }
}

void Singer::setPixmapLocation(QString l)
{
    pixmapLocation = l;
    if (l.isEmpty()) {
        backgroundPixmap = Resource::getInstance()->backgroundPixmap_singer;
    } else {
        backgroundPixmap = new QPixmap(l);
    }
}
